import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    username: '',
    password: ''
  },
  mutations: {
    setUsername(state, username) {
      state.username = username
    },
    setPassword(state, password) {
      state.password = password
    }
  },
  actions: {
    setUsername({ commit }, username) {
      commit('setUsername', username)
    },
    setPassword({ commit }, password) {
      commit('setPassword', password)
    }
  },
  getters: {
    getUsername: state => state.username,
    getPassword: state => state.password
  }
})

export default store